package edu.whu.webgis.service.impl;

import edu.whu.webgis.entity.Footprint;
import edu.whu.webgis.mapper.FootprintMapper;
import edu.whu.webgis.service.IFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class FootprintServiceImpl implements IFootprintService {
    @Autowired
    FootprintMapper mapper;
    @Override
    public List<Footprint> getFootprintById(String id) {
        return mapper.selectByUserId(id);
    }

    @Override
    public int insertFootprint(Footprint footprint) {
        int count = 0;
        try {
            count = mapper.insertFootprint(footprint);
        } catch (Exception e) {
            throw new RuntimeException("足迹插入插入失败,请检查是否已经存在!");
        }
        return count;
    }

    @Override
    public List<String> getHfProvince() {
        return mapper.selectHfProvince();
    }

    @Override
    public List<Map<String, Object>> getCityBase() {
        return mapper.getCityBase();
    }
}
